from time import sleep,ctime
import _thread
import logging
logging.basicConfig(level=logging.INFO)
def loop0():
    logging.info('start loop0 at'+ctime())
    sleep(4)
    logging.info('end loop0 at' + ctime())

def loop1():
    logging.info('start loop1 at'+ctime())
    sleep(5)
    logging.info('end loop1 at' + ctime())

def main():
    logging.info('start all loop at'+ctime()) #主线程结束的时候所有子线程都会强行杀掉
    _thread.start_new_thread(loop0,())
    _thread.start_new_thread(loop1,())
    #sleep(6)
    logging.info('end all loop at' + ctime())
if __name__ == '__main__':
    main()